<body>
    <form id="my-form">
        <div id="tools" class="datagrid-toolbar">
            <input type="hidden" name="type" id="type" value="32">
            <a id="subBtn" name="subOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-save"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-save l-btn-icon-left">保存</span></span></a>
            <a class="easyui-linkbutton l-btn l-btn-plain" id="commitBtn" iconcls="icon-redo" plain="true"
                onclick="commit();" style="display:none"><span class="l-btn-left"><span
                        class="l-btn-text icon-redo l-btn-icon-left">提交</span></span></a>
            <a id="closeBtn" name="backOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a>
        </div>
        <p id="errorMsg" style="color:red;margin-top:5px;"></p>
        <table class="formTable">
            <tbody>
                <tr>
                    <td class="tdc1" style="width:230px;">
                        申请人：
                    </td>
                    <td colspan="3">
                        <input type="text" name="applyUserName" id="applyUserName" data-options="required:true"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="applyUserId" id="applyUserId">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear0" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('applyUserName,applyUserId');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        需求审批表编号：
                    </td>
                    <td colspan="3">
                        <input type="text" name="purchaseCode" id="purchaseCode" data-options="required:true"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="purchaseNeedsId" id="purchaseNeedsId">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear1" iconcls="icon-undo" plain="true"
                            onclick="clearPurchase();"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                        <span style="margin-left:2px;" id="toView"></span>
                    </td>
                </tr>


                <tr>
                    <td class="tdc1" style="width:230px;">
                        费用承担部门：
                    </td>
                    <td colspan="3">
                        <input type="text" name="applyDeptName" id="applyDeptName" data-options="required:true"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="applyDeptId" id="applyDeptId">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear1" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('applyDeptName,applyDeptId');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        审批人：
                    </td>
                    <td colspan="3">
                        <input type="text" name="approvalNames" id="approvalNames" value="王博宇"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="approvalIds" id="approvalIds" value="572">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear2" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('approvalNames,approvalIds');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        总经理：
                    </td>
                    <td colspan="3">
                        <!-- <input type="text" name="managername" id="managername" value="沈全洪" class="easyui-validatebox texfind" readonly/>
						<input type="hidden" name="managerid" id="managerid" value="561"/> -->
                        <input type="text" name="managername" id="managername" value="金额超过1万需沈总审批"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="managerid" id="managerid">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear3" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('managername,managerid');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        董事长：
                    </td>
                    <td colspan="3">
                        <input type="text" name="presidentname" id="presidentname" value="金额超过20万需张总审批"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="presidentid" id="presidentid">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear4" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('presidentname,presidentid');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        总金额：
                    </td>
                    <td colspan="3">
                        <input type="text" id="cost" class="easyui-numberbox numberbox-f validatebox-text" precision="2"
                            numberboxname="cost"><input type="hidden" name="cost" value="">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        供应商选择：
                    </td>
                    <td colspan="3">
                        <textarea name="supplierContent" id="supplierContent"
                            style="width:732px;height:100px"></textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        采购内容：
                    </td>
                    <td colspan="3">
                        <input type="hidden" name="objectId" id="objectId" value="1761740414702">
                        <div id="easyContainer"><input type="file" multiple="" class="fileInput"
                                style="display:none;"><a class="formBtn" id="btu_" style="color:#8C8686;"
                                href="javascript:void(0);">上传</a>
                            <div class="flist" style="margin-top: 0px;"></div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        是否签订合同：
                    </td>
                    <td colspan="3">
                        <select name="is_sign" id="is_sign" onchange="isSign(this.value)" data-options="required:true"
                            class="easyui-validatebox validatebox-text">
                            <option value="0">否</option>
                            <option value="1">是</option>
                        </select>
                    </td>
                </tr>
                <tr class="hidetr" style="display:none">
                    <td class="tdc1">
                        我方单位名称：
                    </td>
                    <td colspan="3">
                        <input type="text" name="myCompanyName" id="myCompanyName"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr class="hidetr" style="display:none">
                    <td class="tdc1">
                        签约单位名称：
                    </td>
                    <td colspan="3">
                        <input type="text" name="companyName" id="companyName"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr class="hidetr" style="display:none">
                    <td class="tdc1">
                        合同名称：
                    </td>
                    <td colspan="3">
                        <input type="text" name="contractName" id="contractName"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr class="hidetr" style="display:none">
                    <td class="tdc1">
                        合同金额<span style="color: red">(此价格为含税)</span>：
                    </td>
                    <td style="width:36%">
                        <input type="text" id="money" class="easyui-numberbox numberbox-f validatebox-text"
                            precision="2" numberboxname="money"><input type="hidden" name="money" value="">
                    </td>
                    <td class="tdc1" style="width:160px;">
                        合同类型：
                    </td>
                    <td>
                        <select name="contractType" id="contractType" onchange="isOther(this.value)"
                            class="easyui-validatebox validatebox-text">
                            <option value="">请选择</option>
                            <option value="1">采购</option>
                            <option value="2">租赁</option>
                            <option value="3">合作</option>
                            <option value="4">服务</option>
                            <option value="5">其他</option>
                        </select>
                    </td>
                </tr>
                <tr id="othertr" style="display:none">
                    <td class="tdc1">
                        其他：
                    </td>
                    <td colspan="3">
                        <input type="text" name="otherthing" id="otherthing"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr class="hidetr" style="display:none">
                    <td class="tdc1">
                        合同内容：
                    </td>
                    <td colspan="3">
                        <textarea name="content" id="content" style="width:70%;height:60px"></textarea>
                    </td>
                </tr>
                <tr class="hidetr" style="display:none">
                    <td class="tdc1">
                        相关附件：
                    </td>
                    <td>
                        <input type="hidden" name="objectId1" id="objectId1" value="1761740414703">
                        <div id="easyContainer1">
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
    <!--
		
		<div style="margin-left:10px;">
			<div style="margin-top: 5px; ">采购内容</div>
			<div id="showFiles">
			</div>
			<span id="uploadBtn">上传</span>
		    <form id="file" name="file" action="/affix" method="post" enctype="multipart/form-data" >
				<div id="fsUploadProgress"></div>
				<input id="btnCancel" type="button" onclick="swfu.cancelQueue();" class="quxiaobtn"/>
			</form> 
			
		</div>
		
		
		--><br>
    <div id="tools" class="datagrid-toolbar">
        <a onclick="javascript:$.messager.alert('提示','请先保存后再录入采购内容');" contextmenu="true:add();"
            class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-add" plain="true" id=""><span
                class="l-btn-left"><span class="l-btn-text icon-add l-btn-icon-left">新增采购内容</span></span></a>
    </div>
    <div class="panel datagrid" style="width: auto;">
        <div class="datagrid-wrap panel-body panel-body-noheader" title="" style="width: 724px; height: auto;">
            <div class="datagrid-view" style="width: 724px; height: 25px;">
                <style type="text/css">
                    div.datagrid-cell-c1-deptNames {
                        width: 192px;
                    }

                    div.datagrid-cell-c1-dicNames {
                        width: 142px;
                    }

                    div.datagrid-cell-c1-reasons {
                        width: 292px;
                    }

                    div.datagrid-cell-c1-reasons {
                        width: 292px;
                    }
                </style>
                <div class="datagrid-view1" style="width: 41px;">
                    <div class="datagrid-header" style="width: 41px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td rowspan="0">
                                            <div class="datagrid-header-rownumber"></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 41px; height: 0px;">
                        <div class="datagrid-body-inner">
                            <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0">
                                <tbody></tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-footer" style="width: 41px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <div class="datagrid-view2" style="width: 683px;">
                    <div class="datagrid-header" style="width: 683px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td field="id">
                                            <div class="datagrid-header-check"><input type="checkbox"></div>
                                        </td>
                                        <td field="deptNames">
                                            <div class="datagrid-cell" style="width: 125px;"><span>名称、型号、配置</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="dicNames">
                                            <div class="datagrid-cell" style="width: 92px;"><span>数量</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="reasons">
                                            <div class="datagrid-cell" style="width: 93px;"><span>单价</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="reasons">
                                            <div class="datagrid-cell" style="width: 93px;"><span>备注</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 683px; height: 0px;">
                        <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0">
                            <tbody></tbody>
                        </table>
                    </div>
                    <div class="datagrid-footer" style="width: 683px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <table id="list_data" style="display: none;"></table>
            </div>
            <div class="datagrid-pager pagination">
                <table cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                        <tr>
                            <td><select class="pagination-page-list">
                                    <option>10</option>
                                    <option>20</option>
                                    <option>30</option>
                                    <option>40</option>
                                    <option>50</option>
                                </select></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-first">&nbsp;</span></span></span></a>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-prev">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><span style="padding-left:6px;">第</span></td>
                            <td><input class="pagination-num" type="text" value="1" size="2"></td>
                            <td><span style="padding-right:6px;">共1页</span></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-next">&nbsp;</span></span></span></a></td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-last">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-load">&nbsp;</span></span></span></a></td>
                        </tr>
                    </tbody>
                </table>
                <div class="pagination-info">显示0到0,共0记录</div>
                <div style="clear:both;"></div>
            </div>
        </div>
    </div>

    <br>
    <div id="tools" class="datagrid-toolbar">
        <a onclick="javascript:$.messager.alert('提示','请先保存后再录入采购内容');" contextmenu="true:add();"
            class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-add" plain="true" id=""><span
                class="l-btn-left"><span class="l-btn-text icon-add l-btn-icon-left">新增货比三家信息</span></span></a>
    </div>
    <div class="panel datagrid" style="width: auto;">
        <div class="datagrid-wrap panel-body panel-body-noheader" title="" style="width: 724px; height: auto;">
            <div class="datagrid-view" style="width: 724px; height: 25px;">
                <style type="text/css">
                    div.datagrid-cell-c2-deptNames {
                        width: 192px;
                    }

                    div.datagrid-cell-c2-dicNames {
                        width: 142px;
                    }

                    div.datagrid-cell-c2-reasons {
                        width: 292px;
                    }

                    div.datagrid-cell-c2-reasons {
                        width: 292px;
                    }
                </style>
                <div class="datagrid-view1" style="width: 41px;">
                    <div class="datagrid-header" style="width: 41px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td rowspan="0">
                                            <div class="datagrid-header-rownumber"></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 41px; height: 0px;">
                        <div class="datagrid-body-inner">
                            <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0">
                                <tbody></tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-footer" style="width: 41px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <div class="datagrid-view2" style="width: 683px;">
                    <div class="datagrid-header" style="width: 683px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td field="id">
                                            <div class="datagrid-header-check"><input type="checkbox"></div>
                                        </td>
                                        <td field="deptNames">
                                            <div class="datagrid-cell" style="width: 125px;"><span>供应商名称</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="dicNames">
                                            <div class="datagrid-cell" style="width: 92px;"><span>报价</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="reasons">
                                            <div class="datagrid-cell" style="width: 93px;"><span>联系人、联系方式</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="reasons">
                                            <div class="datagrid-cell" style="width: 93px;"><span>备注</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 683px; height: 0px;">
                        <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0">
                            <tbody></tbody>
                        </table>
                    </div>
                    <div class="datagrid-footer" style="width: 683px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <table id="list_data2" style="display: none;"></table>
            </div>
            <div class="datagrid-pager pagination">
                <table cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                        <tr>
                            <td><select class="pagination-page-list">
                                    <option>10</option>
                                    <option>20</option>
                                    <option>30</option>
                                    <option>40</option>
                                    <option>50</option>
                                </select></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-first">&nbsp;</span></span></span></a>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-prev">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><span style="padding-left:6px;">第</span></td>
                            <td><input class="pagination-num" type="text" value="1" size="2"></td>
                            <td><span style="padding-right:6px;">共1页</span></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-next">&nbsp;</span></span></span></a></td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-last">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-load">&nbsp;</span></span></span></a></td>
                        </tr>
                    </tbody>
                </table>
                <div class="pagination-info">显示0到0,共0记录</div>
                <div style="clear:both;"></div>
            </div>
        </div>
    </div>
    <br>
    <br>


    <script>

        initSelect(1);//初始化选人框；1：默认根据部门
        initSelectDept();//初始化选择部门
        $("#applyUserName").click(function () {
            showSelect('applyUserName,applyUserId', 'text,id', '');
        });
        $("#purchaseCode").click(function () {
            parent.addTabs("选择采购需求表", contextPath + "system/qdzxapproval/approval/select_purchaseneeds.html?_pfrid=" + $.getUrlParam("_frid"));
        });
        $("#applyDeptName").click(function () {
            showSelectDept('applyDeptName,applyDeptId', 'text,id', '');
        });

        $("#approvalNames").click(function () {
            showSelect('approvalNames,approvalIds', 'text,id', 'checkAny');
        });

        $("#managername").click(function () {
            showSelect('managername,managerid', 'text,id', '');
        });

        $("#presidentname").click(function () {
            showSelect('presidentname,presidentid', 'text,id', '');
        });

        function setParams(id, name) {
            $("#purchaseCode").val(name);
            $("#purchaseNeedsId").val(id);
            var txt = "<a href=\"javascript:viewPurchase(" + id + ");\">查看详情</a>";
            $("#toView").html(txt);
        }

        function viewPurchase(id) {
            var msg = "采购需求申请";
            var url = "purchaseneeds_view.html?id=" + id;
            parent.addTabs("查看" + msg + "-" + id, contextPath + "system/qdzxapproval/approval/" + url + "&_pfrid=" + $.getUrlParam("_frid"));
        }

        function clearPurchase() {
            $("#decorateProjectName").val("");
            $("#decorateProjectId").val("");
            $("#toView").html("");
        }

        function checkFormMe(form) {
            if ($("#is_sign").val() == "1") {
                var myCompanyName = $("#myCompanyName").val();
                if (myCompanyName == null || myCompanyName == "") {
                    $.messager.alert("提示", "【我方单位名称】不能为空", 'info');
                    return false;
                }
                var companyName = $("#companyName").val();
                if (companyName == null || companyName == "") {
                    $.messager.alert("提示", "【签约单位名称】不能为空", 'info');
                    return false;
                }
                var contractName = $("#contractName").val();
                if (contractName == null || contractName == "") {
                    $.messager.alert("提示", "【合同名称】不能为空", 'info');
                    return false;
                }
                var money = $("#money").val();
                if (money == null || money == "") {
                    $.messager.alert("提示", "【合同金额】不能为空", 'info');
                    return false;
                }
                var contractType = $("#contractType").val();
                if (contractType == null || contractType == "") {
                    $.messager.alert("提示", "【合同类型】不能为空", 'info');
                    return false;
                }
                var content = $("#content").val("");
                if (content == null || content == "") {
                    $.messager.alert("提示", "【合同内容】不能为空", 'info');
                    return false;
                }
            }
            return $('#my-form').form('validate');
        }

        var type = $.getUrlParam("type");

        $("#type").val(type);

        var p_id = $.getUrlParam("id");

        var objectId = new Date().getTime();
        var objectId1 = parseInt(objectId) + 1;

        $("#objectId").val(objectId);
        $("#objectId1").val(objectId1);

        var BaseModel = Backbone.Model.extend({ urlRoot: contextPath + 'manager/purchaseApproval' });
        var baseModel;

        if (p_id == null) {
            baseModel = new BaseModel();
        } else {
            baseModel = new BaseModel({ id: p_id, i: new Date().getTime() });
        }
        var baseView = new BaseView({ el: $("#my-form"), model: baseModel });


        //附件
        $('#easyContainer').easyUpload({
            fileTypes: 'all',//all,image,file
            selectText: "上传",//上传按钮文案
            multi: true,//是否允许多文件上传  
            maxNum: 20,//文件上传最大个数
            maxNote: '最多可以上传20个文件，已超出最大上传个数，无法上传！',
            showType: "flist",//展示方。flist,imglist
            fileNote: '文件格式错误，只能上传以下格式',//文件上传说明
            url: contextPath + 'affix',//上传文件地址
            ajaxType: 'POST',//POST,GET
            fileName: 'file',//文件配置参数
            timeout: 300000,//请求超时时间
            formParam: { "objectId": objectId, "objectType": 321 },
        });

        function initSecondSwf() {
            //附件
            $('#easyContainer1').easyUpload({
                fileTypes: 'all',//all,image,file
                selectText: "上传",//上传按钮文案
                multi: true,//是否允许多文件上传  
                maxNum: 20,//文件上传最大个数
                maxNote: '最多可以上传20个文件，已超出最大上传个数，无法上传！',
                showType: "flist",//展示方。flist,imglist
                fileNote: '文件格式错误，只能上传以下格式',//文件上传说明
                url: contextPath + 'affix',//上传文件地址
                ajaxType: 'POST',//POST,GET
                fileName: 'file',//文件配置参数
                timeout: 300000,//请求超时时间
                formParam: { "objectId": objectId1, "objectType": 322 },
            });
        }

        function success(model, response, options) {
            var data = model.get("handleMsg");
            $.messager.alert('提示', model.get("handleMsg").message, 'info', function (rt) {
                if (data.status == 1) {
                    //图层解锁
                    //$("#myForm").unblock();
                    var subtitle = encodeURI(encodeURI($.getUrlParam("subtitle")));
                    window.parent.frames["" + $.getUrlParam("_pfrid")].location.reload();
                    window.location.href = contextPath + "system/qdzxapproval/approval/purchase_approval_edit.html?type=32&processid=" + model.get("id") + "&_pfrid=" + $.getUrlParam("_pfrid") + "&_frid=" + $.getUrlParam("_frid") + "&subtitle=" + subtitle;
                } else {
                    $("#errorMsg").html(data.message);
                    //图层解锁
                    //$("#myForm").unblock();
                }
            });
        }



        $('#list_data').datagrid({
            url: contextPath + "manager/borrowSealDetails?i=" + new Date().getTime(),
            fitColumns: true,
            singleSelect: false,
            rownumbers: true,
            pagination: true,
            sortName: 'id',
            sortOrder: 'desc',
            method: 'POST',
            onRowContextMenu: onRowContextMenu,//右键菜单
            queryParams: { "bid": 0 },
            columns: [[
                { field: 'id', checkbox: true },
                { field: 'deptNames', title: '名称、型号、配置', width: 200 },
                { field: 'dicNames', title: '数量', width: 150 },
                { field: 'reasons', title: '单价', width: 300 },
                { field: 'reasons', title: '备注', width: 300 }
            ]]
        });



        $('#list_data2').datagrid({
            url: contextPath + "manager/borrowSealDetails?i=" + new Date().getTime(),
            fitColumns: true,
            singleSelect: false,
            rownumbers: true,
            pagination: true,
            sortName: 'id',
            sortOrder: 'desc',
            method: 'POST',
            onRowContextMenu: onRowContextMenu,//右键菜单
            queryParams: { "bid": 0 },
            columns: [[
                { field: 'id', checkbox: true },
                { field: 'deptNames', title: '供应商名称', width: 200 },
                { field: 'dicNames', title: '报价', width: 150 },
                { field: 'reasons', title: '联系人、联系方式', width: 300 },
                { field: 'reasons', title: '备注', width: 300 }
            ]]
        });

        function isSign(value) {
            if (value == "0") {
                $(".hidetr").hide();
                $("#myCompanyName").val("");
                $("#companyName").val("");
                $("#contractName").val("");
                $("#money").val("0");
                $("#contractType").val("");
                $("#otherthing").val("");
                $("#othertr").hide();
                $("#content").val("");
            } else if (value == "1") {
                initSecondSwf();
                $(".hidetr").show();
            }
        }

        function isOther(value) {
            if (value == "5") {
                $("#othertr").show();
            } else {
                $("#otherthing").val("");
                $("#othertr").hide();
            }
        }
    </script>
    <div class="panel window" style="display: none; width: 450px; left: 148px; top: 25px;">
        <div class="panel-header panel-header-noborder window-header" style="width: 450px;">
            <div class="panel-title panel-with-icon">根据部门选择</div>
            <div class="panel-icon icon-manager"></div>
            <div class="panel-tool"><a class="panel-tool-collapse" href="javascript:void(0)"></a><a
                    class="panel-tool-close" href="javascript:void(0)"></a></div>
        </div>
        <div id="selectMan" class="easyui-window panel-body panel-body-noborder window-body" title=""
            data-options="closed:true,modal:true,iconCls:'icon-manager',minimizable:false,maximizable:false"
            style="z-index: 301; width: 450px; height: 610px;">
            <div id="selectManHead" class="datagrid-toolbar"><a class="easyui-linkbutton l-btn l-btn-plain"
                    iconcls="icon-ok" plain="true" onclick="checkSelectMan();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-ok l-btn-icon-left">选择</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-reload" plain="true"
                    onclick="reload_data();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-reload l-btn-icon-left">刷新</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close" plain="true"
                    onclick="closeSelectMan();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a></div>
            <div id="menu_tree" class="easyui-tree tree tree-lines" style="margin-top:35px;z-index: 300;"
                data-options="animate:true,lines:true,checkbox:true"></div>
        </div>
    </div>
    <div class="window-shadow" style="display: none; left: 148px; top: 25px;"></div>
    <div class="window-mask" style="width: 796px; height: 843px; display: none;"></div>
    <div class="panel window" style="display: none; width: 350px; left: 198px; top: 10px;">
        <div class="panel-header panel-header-noborder window-header" style="width: 350px;">
            <div class="panel-title panel-with-icon">部门选择</div>
            <div class="panel-icon icon-manager"></div>
            <div class="panel-tool"><a class="panel-tool-collapse" href="javascript:void(0)"></a><a
                    class="panel-tool-close" href="javascript:void(0)"></a></div>
        </div>
        <div id="selectDept" class="easyui-window panel-body panel-body-noborder window-body" title=""
            data-options="closed:true,modal:true,iconCls:'icon-manager',minimizable:false,maximizable:false"
            style="width: 350px; height: 640px;">
            <div class="datagrid-toolbar"><a class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-ok" plain="true"
                    onclick="checkSelectDept();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-ok l-btn-icon-left">选择</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-reload" plain="true"
                    onclick="reload_data_dept();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-reload l-btn-icon-left">刷新</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close" plain="true"
                    onclick="closeSelectDept();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a></div>
            <div id="menu_tree_dept" class="easyui-tree tree tree-lines"
                data-options="animate:true,lines:true,checkbox:true"></div>
        </div>
    </div>
    <div class="window-shadow" style="display: none; left: 198px; top: 10px;"></div>
    <div class="window-mask" style="width: 796px; height: 843px; display: none;"></div>
    <div id="loading1"
        style="position: absolute; left: 0px; top: 0px; width: 100%; height: 819px; background: rgb(232, 232, 232); opacity: 0.5; z-index: 10000; display: none;">
    </div>
    <div id="loading2" class="panel-loading"
        style="position: fixed; top: 38%; left: 41%; border: 2px solid rgb(149, 184, 231); width: 160px; font-size: 14px; z-index: 10001; background: url(&quot;/system/jquery/themes/themes1/images/loading-1.gif&quot;) 10px 8px no-repeat rgb(255, 255, 255); display: none;">
        正在处理，请稍等...</div>
</body>